package labox.innovation.gameserver.handler;

import java.util.Map;
import java.util.TreeMap;

import labox.innovation.gameserver.templates.skills.L2SkillType;

/**
 * This class ...
 *
 * @version $Revision: 1.1.4.4 $ $Date: 2005/04/03 15:55:06 $
 */
public class SkillHandler {

	private Map<L2SkillType, ISkillHandler> _datatable;

	public static SkillHandler getInstance() {
		return SingletonHolder._instance;
	}

	private SkillHandler() {
		_datatable = new TreeMap<L2SkillType, ISkillHandler>();
	}

	public void registerSkillHandler(ISkillHandler handler) {
		L2SkillType[] types = handler.getSkillIds();
		for (L2SkillType t : types) {
			_datatable.put(t, handler);
		}
	}

	public ISkillHandler getSkillHandler(L2SkillType skillType) {
		return _datatable.get(skillType);
	}

	/**
	 * @return
	 */
	public int size() {
		return _datatable.size();
	}

	@SuppressWarnings("synthetic-access")
	private static class SingletonHolder {
		protected static final SkillHandler _instance = new SkillHandler();
	}
}
